@media (max-width: 769px) {
	.obsidian-highlighter-menu {
		--obsidian-highlighter-menu-font-size: 15px;
		--obsidian-highlighter-menu-padding: 4px;
		--obsidian-highlighter-menu-height: 32px;
		--obsidian-undo-button-display: flex;
		--obsidian-highlighter-button-border: none;
		top: auto !important;
		bottom: 25px !important;
	}
}

#obsidian-clipper-iframe {
	color-scheme: light dark;
	flex-grow: 1;
	border: none !important;
	opacity: 0;
	margin: 0 !important;
	&.is-resizing {
		user-select: none;
		-webkit-user-select: none;
		pointer-events: none;
	}
}

#obsidian-clipper-container {
	color-scheme: light dark;
	position: fixed;
	top: 12px;
	right: 12px;
	max-width: calc(100% - 24px);
	min-width: 240px;
	max-height: calc(100% - 24px);
	min-height: 320px;
	height: calc(100% - 24px);
	width: 350px;
	z-index: 9999999999;
	background-color: var(--obsidian-clipper-background-primary);
	background-color: rgba(var(--obsidian-clipper-background-primary-rgb), var(--obsidian-clipper-background-opacity));
	backdrop-filter: saturate(1.5) blur(32px);
	border-radius: 12px;
	box-shadow: 0 0 0 1px rgba(0,0,0,0.1), 
		0px 16px 28px -4px rgba(0, 0, 0, 0.15), 
		0px 8px 16px -4px rgba(0, 0, 0, 0.06);
	display: flex;
	flex-direction: column;
	user-select: none;
	-webkit-user-select: none;
	transform-origin: right top;
	opacity: 0;
	transform: scale(0.95);

	&.is-open {
		animation: 80ms ease 60ms 1 normal forwards running clipperOpenAnimation;
		#obsidian-clipper-iframe {
			opacity: 1;
		}
	}
	&.is-closing {
		animation: 80ms ease 1 normal forwards running clipperCloseAnimation;
	}
}

:root {
	--obsidian-clipper-background-primary: #fff;
	--obsidian-clipper-background-primary-rgb: 255, 255, 255;
	--obsidian-clipper-background-opacity: 0.9;
	--obsidian-clipper-text-muted: #5c5c5c;
}
@media (prefers-color-scheme: dark) {
	:root {
		--obsidian-clipper-background-primary: #1e1e1e;
		--obsidian-clipper-background-primary-rgb: 12, 12, 12;
	}
}

.obsidian-clipper-resize-handle {
	position: absolute;
	&.obsidian-clipper-resize-handle-w {
		top: 10px;
		left: -5px;
		bottom: 10px;
		width: 10px;
		cursor: ew-resize;
		z-index: 99999999999;
	}
	&.obsidian-clipper-resize-handle-s {
		position: absolute;
		bottom: -5px;
		left: 10px;
		right: 10px;
		height: 10px;
		cursor: ns-resize;
		z-index: 99999999999;
	}
	&.obsidian-clipper-resize-handle-sw {
		position: absolute;
		bottom: -5px;
		left: -5px;
		width: 16px;
		height: 16px;
		cursor: nesw-resize;
		z-index: 99999999999;
	}
}
/* Hide the clip button on iPadOS because it's not supported */
.is-ipad-os {
	.obsidian-highlighter-menu {
		#obsidian-clip-button {
			display: none;
		}
	}
}

body.obsidian-highlighter-active {
	--obsidian-highlighter-menu-font-size: 13px;
	--obsidian-highlighter-menu-padding: 4px;
	--obsidian-highlighter-menu-height: 24px;
	--obsidian-undo-button-display: none;
	--obsidian-highlighter-button-border: inset rgba(255, 255, 255, 0.1) 0px 0px 0px 1px !important;

	// Disable pinch zoom on mobile
	touch-action: pan-x pan-y;
	cursor: crosshair;
	a {
		cursor: crosshair !important;
	}
	*::selection {
		background-color: rgba(255, 235, 0, 0.35) !important;
	}
	.obsidian-highlight-overlay {
		cursor: pointer;
		pointer-events: auto;
	}
}

.obsidian-highlighter-menu {
	box-sizing: border-box !important;
	cursor: default;
	position: fixed;
	top: 20px;
	left: 50%;
	transform: translateX(-50%);
	border: 1px solid #424242;
	background: #353535;
	color: #fff;
	padding: var(--obsidian-highlighter-menu-padding);
	height: calc(var(--obsidian-highlighter-menu-height) + var(--obsidian-highlighter-menu-padding) * 2);
	border-radius: var(--obsidian-highlighter-menu-height);
	display: flex;
	align-items: center;
	gap: 4px;
	z-index: 9999999999;
	font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
	font-size: var(--obsidian-highlighter-menu-font-size) !important;
	font-weight: 600 !important;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
	user-select: none;
	-webkit-user-select: none;
	-webkit-font-smoothing: antialiased !important;
	font-variant-numeric: tabular-nums;
	white-space: nowrap !important;

	.no-highlights {
		font-weight: 600 !important;
		padding: 0 4px 0 8px;
	}

	button#obsidian-redo-highlights:not(.active),
	button#obsidian-undo-highlights:not(.active) {
		background-color: transparent !important;
		opacity: 0.5;
		cursor: default !important;
	}
	button#obsidian-undo-highlights,
	button#obsidian-redo-highlights {
		display: var(--obsidian-undo-button-display) !important;
	}

	.highlight-count {
		font-variant-numeric: tabular-nums;
		color: #bebebe !important;
		padding-inline-start: 4px;
	}

	button#obsidian-clear-highlights {
		padding: 0 8px 0 8px !important;
	}

	button {
		font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Microsoft YaHei Light", sans-serif !important;
		font-size: var(--obsidian-highlighter-menu-font-size) !important;
		appearance: none !important;
		background-color: transparent !important;
		color: #bebebe !important;
		font-weight: 600 !important;
		height: var(--obsidian-highlighter-menu-height) !important;
		min-width: var(--obsidian-highlighter-menu-height) !important;
		padding: 0 !important;
		border-radius: var(--obsidian-highlighter-menu-height) !important;
		border: none !important;
		cursor: pointer !important;
		box-shadow: none !important;
		outline: none !important;
		display: flex;
		align-items: center;
		justify-content: center;
		font-variant-numeric: tabular-nums !important;
		gap: 4px;
		background-color: rgba(255, 255, 255, 0.1) !important;
		box-shadow: var(--obsidian-highlighter-button-border) !important;
		-webkit-font-smoothing: antialiased !important;
		svg {
			mix-blend-mode: normal !important;
			color: #bebebe;
			width: 16px;
			height: 16px;
			path, line {
				color: #bebebe;
			}
		}
		@media (hover: hover) {
			&:hover {
				color: white !important;
				background-color: rgba(255, 255, 255, 0.25) !important;
				svg {
					color: white !important;
					path, line {
						color: white !important;
					}
				}
			}
		}
		&.mod-cta {
			background-color: #895DF4 !important;
			color: white !important;
			padding: 0 8px !important;
			box-shadow: var(--obsidian-highlighter-button-border) !important;
			@media (hover: hover) {
				&:hover {
					background-color: #A68AF9 !important;
				}
			}
		}
	}
}

body.obsidian-highlighter-always-show,
body.obsidian-highlighter-active {
	.obsidian-highlight-overlay {
		display: block;
	}
}

.obsidian-highlight-overlay {
	display: none;
	position: absolute;
	background-color: rgba(255, 235, 0, 0.35);
	border-radius: 4px;
	mix-blend-mode: multiply;
	pointer-events: none;
	z-index: 999999998;

	.copy-url-button {
		display: none;
		position: absolute;
		top: -16px;
		right: -2px;
		background: #353535 !important;
		border: 1px solid #424242 !important;
		border-radius: 4px !important;
		color: #bebebe !important;
		padding: 2px 6px !important;
		font-size: 12px !important;
		font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif !important;
		cursor: pointer !important;
		pointer-events: all;
		white-space: nowrap;
		gap: 4px;
		align-items: center;
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
		
		svg {
			mix-blend-mode: normal !important;
			width: 12px;
			height: 12px;
			vertical-align: middle;
			margin-right: 4px;
		}

		@media (hover: hover) {
			&:hover {
				background: #424242 !important;
				color: white !important;
			}
		}

		&.copied {
			background: #4CAF50 !important;
			color: white !important;
		}
	}

	// &:hover .copy-url-button {
	// 	display: inline-flex;
	// }

	&.is-hovering {
		border: 2px dashed rgb(255, 235, 0, 1);
		pointer-events: all;
	}

	&.obsidian-highlight-overlay-dark {
		mix-blend-mode: screen;
		background-color: rgba(255, 235, 0, 0.25);
		&.is-hovering {
			border: 2px dashed rgb(255, 235, 0, 0.5);
		}

		.copy-url-button {
			background: #1a1a1a !important;
			border-color: #2a2a2a !important;
			
			@media (hover: hover) {
				&:hover {
					background: #2a2a2a !important;
				}
			}
		}
	}
}

#obsidian-highlight-hover-overlay {
	position: absolute;
	border-radius: 4px;
	border: 2px dashed rgb(255, 235, 0, 0.8);
	pointer-events: none;
	z-index: 999999997;
	&.on-highlight {
		border-color: transparent;
	}
}

@keyframes clipperOpenAnimation {
	to {
		opacity: 1;
		transform: scale(1);
	}
}

@keyframes clipperCloseAnimation {
	from {
		opacity: 1;
		transform: scale(1);
	}
	to {
		opacity: 0;
		transform: scale(0.96);
	}
}
